<!--
 * @FileDescription: hr界面的菜单栏表单
 * @Author: 叶永鸿、袁年政
 * @Date: 2021-7-17
 * @LastEditors: 叶永鸿
 * @LastEditTime: 2021-7-18
 -->
<template>
  <div class="left">
    <el-row class="tac">
      <el-col :span="50">
        <el-menu
          :uniqueOpened="true"
          default-active="this.$router.path"
          router
          class="el-menu-vertical-demo"
          background-color="#cee6fa"
          text-color="#464653"
          active-text-color="#373737"
        >
          <el-menu-item index="1" @click="toMyInfor">
            <i class="el-icon-plus"></i>
            <template #title>个人信息</template>
          </el-menu-item>
          <!-- <el-menu-item index="2" @click="toSearch">
            <i class="el-icon-zoom-in"></i>
            <template #title>查询</template>
          </el-menu-item> -->
        </el-menu>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  name: "leftEmp",
  methods: {
    toMyInfor() {//跳转到员工个人信息页面的按钮功能函数
      var that = this;
      var empInfor;
      var empExp;
      that.$axios
        .get("http://47.100.167.206:8082/Query/empsearchmyself", {//首先从服务器获取个人基础信息
          headers: {
            token: this.$store.state.loginInfor.token,
          },
        })
        .then(
          function (response) {
            empInfor = response.data.data;
            console.log(response.data.data);
            that.$axios
              .get("http://47.100.167.206:8082/Query/queryExperience", {//获得员工就职经历
                headers: {
                  token: that.$store.state.loginInfor.token,
                },
              })
              .then(
                function (response) {
                  empExp = response.data.data;
                  console.log(response);
                  that.$store.commit("empInformation", {
                    empInfor: empInfor,
                    empExp: empExp,
                  });
                  //that.$router.push("/emMain/myself");
                  that.$axios
                    .get(
                      "http://47.100.167.206:8082//Query/empqueryPerformance",//获取员工在当前公司的绩效
                      {
                        params: {
                          empid: empInfor.empid,
                        },
                        headers: {
                          token: that.$store.state.loginInfor.token,
                        },
                      }
                    )
                    .then(
                      function (response) {
                        console.log(response);
                        that.$store.commit("Performance_Mine", {
                          performances: response.data.data,
                        });
                        that.$router.push("/emMain/myself");
                      },
                      function (err) {
                        console.log(err);
                      }
                    );
                },
                function (err) {
                  console.log(err);
                }
              );
          },
          function (err) {
            console.log(err);
          }
        );

      //that.$router.push("/emMain/myself");
    },

    // toSearch() {
    //   this.$router.push("/");
    // },
  },
};
</script>

<style scoped>
/* .tac{
  height: 100%;
} */
.el-col {
  height: 100%;
  width: 100%;
}
.el-row {
  background-color: #194577;
  color: rgb(17, 2, 2);
  text-align: center;
  line-height: 100vh;
  height: 100%;
  width: 100%;
}
.el-menu {
  height: 100%;
  width: 100%;
}
.left {
  overflow-x: hidden;
  height: 100%;
}
</style>
